<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="js/vue.js"></script>
		<script src="js/vue-resource.min.js"></script>
		<script src="https://cdn.staticfile.org/axios/0.18.0/axios.min.js"></script>
	</head>
	<body>
		<div id="app">
			请输入关键字：<input type="text" v-model="keyword" @keyup="sendJsonP(keyword)">
			<ul>
				<li v-for="r in result">{{r}}</li>
			</ul>
		</div>
		<script>
			window.onload = function() {
				new Vue({
					el: '#app',
					data: {
						keyword: '',
						result: ''
					},
					methods: {
						sendJsonP(keyword) {
							let url = 'http://localhost:1004/oa/test';
							this.$http.jsonp(url,
								
							).then(res => {
								if (res.data.g) {
									this.result = res.data.g.map(x => x['q']);
								} else {
									this.result = [];
								}
							}).catch(err => {
	
});
						}
					}
				});
			}
		</script>
	</body>
</html>
